package com.szqhyxj.youxiangju.biz.receipt.record.detail.quick;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.szqhyxj.youxiangju.BaseActivity;
import com.szqhyxj.youxiangju.R;
import com.szqhyxj.youxiangju.biz.receipt.record.OrderCashDetailVO;
import com.szqhyxj.youxiangju.biz.receipt.record.detail.device.DeviceReceiptDetailsActivity;
import com.szqhyxj.youxiangju.sys.components.NavigationBar;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by leung on 2018/11/27.
 */

public class QuickReceiptDetailsActivity extends BaseActivity implements NavigationBar.NavigationBarListener {

    @BindView(R.id.navigationBar)
    NavigationBar navigationBar;
    @BindView(R.id.tradeAmt)
    TextView tradeAmt;
    @BindView(R.id.titlearea)
    LinearLayout titlearea;
    @BindView(R.id.view)
    View view;
    @BindView(R.id.arrivalAmt)
    TextView arrivalAmt;
    @BindView(R.id.rate)
    TextView rate;
    @BindView(R.id.cardNo)
    TextView cardNo;
    @BindView(R.id.depositCard)
    TextView depositCard;
    @BindView(R.id.merchantType)
    TextView merchantType;
    @BindView(R.id.tradeOrder)
    TextView tradeOrder;
    @BindView(R.id.addDate)
    TextView addDate;
    @BindView(R.id.type)
    TextView type;
    @BindView(R.id.fail)
    TextView fail;

    public static void start(Activity activity, OrderCashDetailVO orderCashDetailVO, String data) {
        Intent intent = new Intent();
        intent.setClass(activity, QuickReceiptDetailsActivity.class);
        intent.putExtra("ordervo", orderCashDetailVO);
        intent.putExtra("data", data);
        activity.startActivity(intent);

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_online_receipt_details);
        ButterKnife.bind(this);
        navigationBar.setNavigationBarListener(this);
        OrderCashDetailVO orderCashDetailVO = getIntent().getParcelableExtra("ordervo");

        if (orderCashDetailVO.getIsSuccess()==null){
            type.setText("收款中");
        }else{
            if (orderCashDetailVO.getIsSuccess().equals("0")) {
                type.setText("收款失败");
                type.setTextColor(getResources().getColor(R.color.textcolor4e));
                fail.setVisibility(View.VISIBLE);
                fail.setText(orderCashDetailVO.getTradeMsg() );
                fail.setTextColor(getResources().getColor(R.color.textcolor4e));
            }
            if (orderCashDetailVO.getIsSuccess().equals("1")) {
                type.setText("收款成功");
            }
            if (orderCashDetailVO.getIsSuccess().equals("2")) {
                type.setText("收款中");
            }
        }

        tradeAmt.setText("-" + orderCashDetailVO.getTradeAmt() );
        cardNo.setText(orderCashDetailVO.getCardNo() );
        addDate.setText("");
        arrivalAmt.setText(orderCashDetailVO.getArrivalAmt() + "元");
        rate.setText(orderCashDetailVO.getRate() + "元");
        merchantType.setText(orderCashDetailVO.getMerchantType() );
        tradeOrder.setText(orderCashDetailVO.getTradeOrder() );
        depositCard.setText(orderCashDetailVO.getDepositCard() );
        addDate.setText(getIntent().getStringExtra("data"));

    }

    @Override
    public void navigationLeft() {
        finish();
    }

    @Override
    public void navigationRight() {

    }
}